package Servlet.ComprobantePago;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huellas.bean.ListadoCitasComprobanteBean;
import com.huellas.negocio.GestionComprobantes;

/**
 * Servlet implementation class DatosBoletaGeneradaServlet
 */
@WebServlet("/DatosBoletaGeneradaServlet")
public class DatosBoletaGeneradaServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DatosBoletaGeneradaServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		int CodeCita = Integer.parseInt(request.getParameter("code"));
		GestionComprobantes gc = new GestionComprobantes();
		try {
			// Datos de la cabecera a Mostrar Consulta
			
			Collection<ListadoCitasComprobanteBean> CabeceraComprobante = new ArrayList<ListadoCitasComprobanteBean>();
			CabeceraComprobante = gc.ListaCabeceraComprobante(CodeCita, "C");
			request.setAttribute("CabeceraComprobante", CabeceraComprobante);
			
			// Datos delDetalle a Mostrar Consulta			
			Collection<ListadoCitasComprobanteBean> DetalleComprobante = new ArrayList<ListadoCitasComprobanteBean>();
			DetalleComprobante = gc.ListaDetalleComprobante(CodeCita, "D");
			request.setAttribute("DetalleComprobante", DetalleComprobante);
			
				RequestDispatcher rd = request.getRequestDispatcher("DatosBoletaGenerada.jsp");
				rd.forward(request, response);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

	}

}
